from functools import wraps


# 单例模式装饰器
def singleton_decorator(cls):
    instances = {}

    @wraps(cls)
    def singleton_wrapper(*args, **kwargs):
        if cls not in instances:
            instances[cls] = cls(*args, **kwargs)
        return instances[cls]

    return singleton_wrapper
